game_manager
	{
	spawn
		{

		// Game rules
		wm_axis_respawntime	30
		wm_allied_respawntime	20
		wm_number_of_objectives 6
		wm_set_round_timelimit	15

		//Objective 1:  Main Door
		//Objective 2:  Side Door
		//Objective 3:  West Radar Parts
		//Objective 4:  East Radar Parts
		//Objective 5:  Flag
		//Objective 6:  Command Post

		// Current main objectives for each team (0=Axis, 1=Allies)
		wm_objective_status 1 0 0
		wm_objective_status 1 1 0
		wm_objective_status 2 0 0
		wm_objective_status 2 1 0
		wm_objective_status 3 0 0
		wm_objective_status 3 1 0
		wm_objective_status 4 0 0
		wm_objective_status 4 1 0
		wm_objective_status 5 0 0
		wm_objective_status 5 1 0
		wm_objective_status 6 0 0
		wm_objective_status 6 1 0

		// Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team	0

		// Winner on expiration of round timer (0=Axis, 1=Allies)
		wm_setwinner	0
		
		wait 150

		setautospawn "Cathedral"			1
		setautospawn "Cathedral"			0

		}

	trigger stolen_circuit 
		{ 
		accum 1 inc 1 // One circuit board home 
		trigger game_manager checkgame // Check for end of game 
		} 

	trigger checkgame 
		{ 
		accum 1 abort_if_not_equal 2 
		wm_setwinner 1 
		wait 500 
		wm_endround 
		} 	
	} 

//==========================================================================
//Returnable Objectives ====================================================
//==========================================================================

//Code for the solid radar models. 
truckbox1 
	{ 
	spawn 
		{ 
		wait 50 
		setstate truckbox1 invisible 
		accum 1 set 0 
		} 

	trigger visible 
		{ 
		setstate truckbox1 default 
		accum 1 abort_if_not_equal 0 

		wm_announce "Allies have secured the West Radar Parts!" 

		// *----------------------- vo ----------------------------* 
		wm_teamvoiceannounce 0 "radar_axis_radarw_secured" 
		wm_teamvoiceannounce 1 "radar_allies_radarw_secured" 
		wm_removeteamvoiceannounce 0 "radar_axis_radarw_defend" 
		// *-------------------------------------------------------*
		
		accum 1 set 1 
		} 

	trigger invisible 
		{ 
		setstate truckbox1 invisible 
		} 
	} 


truckbox2 
	{ 
	spawn 
		{ 
		wait 50 
		setstate truckbox2 invisible 
		accum 1 set 0 
		} 
		
	trigger visible 
		{ 
		setstate truckbox2 default 
		accum 1 abort_if_not_equal 0 

		wm_announce "Allies have secured the East Radar Parts!" 

		// *----------------------- vo ----------------------------*
		wm_teamvoiceannounce 0 "radar_axis_radare_secured" 
		wm_teamvoiceannounce 1 "radar_allies_radare_secured" 
		wm_removeteamvoiceannounce 0 "radar_axis_radare_defend" 
		// *------------------------------------------------------* 

		accum 1 set 1 
		} 

	trigger invisible 
		{ 
		setstate truckbox2 invisible 
		} 
	} 

// Code for the transparent versions 
truckboxtrans1 
	{ 
	trigger visible 
		{ 
		setstate truckboxtrans1 default 
		} 

	trigger invisible 
		{ 
		setstate truckboxtrans1 invisible 
		} 
	} 

truckboxtrans2 
	{ 
	trigger visible 
		{ 
		setstate truckboxtrans2 default 
		} 

	trigger invisible 
		{ 
		setstate truckboxtrans2 invisible 
		} 
	} 


//Code for the team_ctf_redflag entitys 
radarbox1 
	{ 
	spawn 
		{ 
		wait 500
		setstate obj_westparts invisible
		setstate obj_westparts_toi invisible
		} 

	trigger stolen 
		{ 
		wait 200 

		setstate radarbox1_target invisible

		// *----------------------- vo ----------------------------* 
		wm_teamvoiceannounce 0 "radar_axis_radarw_taken" 
		wm_teamvoiceannounce 1 "radar_allies_radarw_taken" 
		// *------------------------------------------------------* 
		} 

	trigger returned 
		{
		setstate radarbox1_target default
 
		// *----------------------- vo ----------------------------*
		wm_teamvoiceannounce 0 "radar_axis_radarw_returned" 
		wm_teamvoiceannounce 1 "radar_allies_radarw_returned" 
		// *------------------------------------------------------* 
		} 

	trigger captured 
		{ 
		trigger truckbox1 visible 
		trigger truckboxtrans1 invisible
		setstate obj_westparts default
		setstate obj_westparts_toi default

		wm_objective_status 3 0 2
		wm_objective_status 3 1 1
		} 
	} 

radarbox2 
	{ 
	spawn 
		{ 
		wait 500
		setstate obj_eastparts invisible
		setstate obj_eastparts_toi invisible
		} 

	trigger stolen 
		{ 

		wait 200

		setstate radarbox2_target invisible

		// *----------------------- vo ----------------------------*
		wm_teamvoiceannounce 0 "radar_axis_radare_taken" 
		wm_teamvoiceannounce 1 "radar_allies_radare_taken" 
		// *------------------------------------------------------* 
		} 

	trigger returned 
		{ 
		setstate radarbox2_target default

		// *----------------------- vo ----------------------------* 
		wm_teamvoiceannounce 0 "radar_axis_radare_returned" 
		wm_teamvoiceannounce 1 "radar_allies_radare_returned" 
		// *------------------------------------------------------*
		} 

	trigger captured 
		{ 
		trigger truckbox2 visible 
		trigger truckboxtrans2 invisible 
		setstate obj_eastparts default
		setstate obj_eastparts_toi default

		wm_objective_status 4 0 2
		wm_objective_status 4 1 1
		} 
	} 

// The trigger_flag_multiple 
truck_exitpoint // Exit point of map 
	{ 
	death 
		{ 
		trigger game_manager stolen_circuit 
		} 
	}

//==========================================================================
//Forward Flag =============================================================
//==========================================================================

//CAPTURABLE SPAWN
oldcityflag
	{
	spawn
		{
		accum 0 set 0	// Who has the flag: 0-Axis, 1-Allied
		}

	trigger axis_capture	// Flag has been touched by an Axis player
		{
		accum 0 abort_if_equal 0 // do Axis own flag?

		accum 0 set 0 // Axis own the pole
		wm_announce	"Axis reclaim the Cathedral!"

		wm_objective_status 		5 0 1
		wm_objective_status 		5 1 2

		alertentity old_city_wobj
		}

	trigger allied_capture	// Flag has been touched by an allied player
		{
		accum 0 abort_if_equal 1 // do Allies own flag?

		accum 0 set 1 // Allied own the flag
		wm_announce	"Allies capture the Cathedral!"

		wm_objective_status 		5 0 2
		wm_objective_status 		5 1 1

		alertentity old_city_wobj
		}

	trigger check_obj
		{
		accum 0 abort_if_equal 1 // Do Allied own the flag?

		wm_objective_status 		5 0 2
		wm_objective_status 		5 1 1

		}

	trigger force_allied
		{
		accum 0 abort_if_equal 1 // Do Allied own the flag?

		alertentity old_city_wobj
		alertentity oldcityspawns
		}

	trigger kill
		{
		remove
		}
	}

//==========================================================================
//Dynamitable Objectives ===================================================
//==========================================================================

oldcitywall //Broken section of Old City wall
	{
	spawn
		{
		wait 200
		set
			{
			constructible_class 1
			health "100"
			}

		setstate obj_maindoor invisible
		setstate obj_maindoor_toi invisible
		}

	death
		{
		trigger oldcityflag force_allied // Switch forward spawn to Allied ONLY

		trigger oldcityflag check_obj

		trigger oldcityflag kill

		trigger main_od do_open

		wm_announce "Allies have breached the Main Gate"
		setstate obj_maindoor default
		setstate obj_maindoor_toi default

		wm_objective_status 		1 0 2
		wm_objective_status 		1 1 1
		}
	}

//Open main door
main_td
{
	spawn
	{
		wait 50
		setstate main_td default
		setstate main_od invisible
	}
	trigger do_hide
	{
		setstate main_td invisible
	}
}

main_od
{
	spawn
	{
		wait 50
		setstate main_od invisible
	}
	
	trigger do_open
	{
		setstate main_od default
		trigger main_td do_hide
		wait 100
		faceangles 0 90 0 1500
	}
}



//DYNO SIDE DOOR
dynamitetest
	{
  	spawn
   		{
      		wait 200
      				set
			{
			constructible_class 1
			health "100"
			}

		setstate obj_sidedoor invisible
		setstate obj_sidedoor_toi invisible
   		}
   	death
   		{
      		wm_announce "Allies have blown open the Side Door!"
		setstate obj_sidedoor default
		setstate obj_sidedoor_toi default

		wm_objective_status 2 0 2
		wm_objective_status 2 1 1
   		}
	}

// ============================================================================ 
// NEUTRAL COMMAND POST =======================================================
// FROM Goldrush Thx SD!!! prefab by seven 2003 ===============================
// ============================================================================ 

allied_compost_built
{
	spawn
	{
		wait 400
		trigger allied_compost_built setup

		constructible_class 2
	}

	trigger setup
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0
	}

	buildstart final
	{
		setstate allied_compost_built_model underconstruction
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible
	}

	built final
	{
		setstate allied_compost_built_model default
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible

		trigger allied_compost_built_model enable_allied_features

		enablespeaker allied_cp_speaker
		setstate allied_cp_two	default
		alertentity allied_cp_blob
	}

	decayed final
	{
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default
	}

	death
	{
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger allied_compost_built_model disable_allied_features

		disablespeaker allied_cp_speaker
		alertentity allied_cp_blob
		setstate allied_cp_two	invisible		
	}
}

allied_compost_built_model
{
	spawn
	{
		wait 400
		setstate allied_compost_built_model invisible
	}

	trigger enable_allied_features
	{
		setchargetimefactor 1 soldier 0.75
		setchargetimefactor 1 lieutenant 0.75
		setchargetimefactor 1 medic 0.75
		setchargetimefactor 1 engineer 0.75
		setchargetimefactor 1 covertops 0.75
		sethqstatus 1 1

		wm_announce	"Allied Command Post constructed. Charge speed increased!"

		// *----------------------- vo ----------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed_allies"
		wm_teamvoiceannounce 1 "allies_hq_compost_constructed"
		wm_removeteamvoiceannounce 1 "allies_hq_compost_construct"
		// *------------------------------------------------------*

		wm_objective_status 6 0 2
		wm_objective_status 6 1 1
	}

	trigger disable_allied_features
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0

		wm_announce	"Axis team has destroyed the Allied Command Post!"

		// *----------------------- vo ----------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"
		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"
		wm_teamvoiceannounce 0 "axis_hq_compost_construct"
		wm_teamvoiceannounce 1 "allies_hq_compost_damaged"
		// *------------------------------------------------------*

		wm_objective_status 6 0 0
		wm_objective_status 6 1 0
	}
}

axis_compost_built
{
	spawn
	{
		wait 400
		trigger axis_compost_built setup

		constructible_class 2
	}

	trigger setup
	{
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0
	}

	buildstart final
	{
		setstate axis_compost_built_model underconstruction
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible
	}

	built final
	{
		setstate axis_compost_built_model default
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible

		trigger axis_compost_built_model enable_axis_features

		enablespeaker axis_cp_speaker
		
	}

	decayed final
	{
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default
	}

	death
	{
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger axis_compost_built_model disable_axis_features

		disablespeaker axis_cp_speaker
		
	}
}

axis_compost_built_model
{
	spawn
	{
		wait 400
		setstate axis_compost_built_model invisible
	}

	trigger enable_axis_features
	{
		setchargetimefactor 0 soldier 0.75
		setchargetimefactor 0 lieutenant 0.75
		setchargetimefactor 0 medic 0.75
		setchargetimefactor 0 engineer 0.75
		setchargetimefactor 0 covertops 0.75
		sethqstatus 0 1

		wm_announce	"Axis Command Post constructed. Charge speed increased!"

		// *----------------------- vo ----------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed"
		wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"
		wm_removeteamvoiceannounce 0 "axis_hq_compost_construct"
		// *------------------------------------------------------*

		wm_objective_status 6 0 1
		wm_objective_status 6 1 2
	}

	trigger disable_axis_features
	{
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0

		wm_announce	"Allied team has destroyed the Axis Command Post!"

		// *----------------------- vo ----------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"
		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"
		wm_teamvoiceannounce 0 "axis_hq_compost_damaged"
		wm_teamvoiceannounce 1 "allies_hq_compost_construct"
		// *------------------------------------------------------*

		wm_objective_status 6 0 0
		wm_objective_status 6 1 0
	}
}

// ============================================================================ 
// Command Post Spawns ========================================================
// ============================================================================ 

allied_cp_two
{
	spawn
	{
		wait 100
		setstate allied_cp_two invisible
	}
}

axis_cp_two
{
	spawn
	{
		wait 100
		setstate axis_cp_two invisible
	}
}